package cn.silver.framework.core.model;

import cn.hutool.json.JSONObject;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author zhouxiaobo
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "DictModel", description = "数据字典对象")
public class DictModel implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    @Schema(title = "字典ID")
    private String id;
    @Schema(title = "字典名")
    private String label;
    @Schema(title = "字典值")
    private String value;
    @Schema(title = "字典分组编码")
    private String group;
    @Schema(title = "字典样式")
    private String cssClass;
    @Schema(title = "列表样式")
    private String listClass;
    @Schema(title = "字典序号")
    private Integer sort;
    @Schema(title = "字典说明")
    private String remark;
    private JSONObject raw = new JSONObject();

    public DictModel(String label, String value) {
        this.label = label;
        this.value = value;
    }

    public DictModel(String label, String value, JSONObject raw) {
        this.label = label;
        this.value = value;
        this.raw = raw;
    }

    public DictModel(String label, String value, Integer sort) {
        this(label, value);
        this.sort = sort;
    }

    public DictModel(String label, String value, String group) {
        this(label, value);
        this.group = group;
    }

    public DictModel(String label, String value, String group, String remark) {
        this(label, value, group);
        this.remark = remark;
    }

    public DictModel(String id, String label, String value, String group, Integer sort, String remark) {
        this(label, value, group, remark);
        this.id = id;
        this.sort = sort;
    }
}
